package com.nick.factory.abstractfactory;

import com.nick.factory.Fruit;

/**
 * Created by xiaobao on 2017/7/13.
 */
public abstract class AbstractFruitFactory {
    protected abstract Fruit createFruit();
    public Fruit createFruit(String name) {
        if ("Apple".equals(name)) {
            return new AppleFactory().createFruit();
        } else if ("Banana".equals(name)) {
            return new BananaFactory().createFruit();
        } else {
            return null;
        }
    }
}
